<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class BlogComments extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('comments', function (Blueprint $table) {
            $table->increments('id');
            $table->string('content')->comment('评论');
            $table->string('reply')->default("")->comment('回复');
            $table->string('nickname')->comment('昵称');
            $table->string('email')->comment('邮箱');
            $table->integer('article_id')->index('article_id')->unsigned()->comment('文章ID');
            $table->integer('addtime')->unsigned()->comment('评论时间');
            $table->unsignedTinyInteger('is_show')->default(2)->comment('审核');
            $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('comments');
    }
}
